/**
 * Exception 异常捕获类
 * @author zhangjl
 * @namespace gui.util
 * @singleton Exception
 */
gui.util.Exception = {

	_try:function(ret,obv) {
		if(!obv) return;
		
		if(typeof ret == undefined || typeof ret == 'undefied'){
			gui.util.Error._throw(gui.util.ErrorCode[10001]);
			return false;
		}
		
		var jsonStr;
		if(typeof ret == 'string' && ret.indexOf("\"ret\":")>0){
			if(JSON){
				jsonStr=JSON.parse(ret);
			}else{
				jsonStr = eval('(' + ret + ')'); 
			}
		}else {
			jsonStr = ret;
		}
		
		if(jsonStr && jsonStr.ret != undefined && parseFloat(jsonStr.ret) > 0){
			if(gui.util.ErrorCode[jsonStr.ret]!=undefined){
				gui.util.Error._throw(gui.util.ErrorCode[jsonStr.ret]);
				return false;
			}
			
			obv.call(window,jsonStr);
			return false;
		}
		obv.call(window,jsonStr);
	}
}